function sort<T>(array:T[],type:number){
    if(type == 1){
        array.sort()
    }else if(type == 2){
        array.sort((a,b)=>{
            // @ts-ignore
            return b - a
        })
    }else {
        array.sort((a,b)=>{
            return 0.5-Math.random()
        })
    }
}

/**
 * 字符串中每个字符出现的次数，统计出来
 * @param str abcdefabcd
 * new Map()
 */
interface IRes {
    [index:string]:number
}
function findStr(str:string){
    const res = str.split("")
    let obj:IRes = {}
    for (let index = 0; index < res.length; index++) {
        if(obj[str[index]]){
            obj[str[index]]++
        }else{
            obj[str[index]] = 1
        }
    }   
    for (const key in obj) {
        if(obj[key] == 1){
            console.log(key);
        }
    }
}

const phone = "18900123450".replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")
